package com.eden.manage.controller;


import com.eden.manage.dto.PageComDto;
import com.eden.manage.dto.agent.AgentProfitDto;
import com.eden.manage.req.query.AgentProfitQuery;
import com.eden.manage.service.AgentProfitService;
import eden.api.common.model.EdenPageResult;
import eden.api.common.model.EdenResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("agent/profit")
@RestController
@RequiredArgsConstructor
public class AgentProfitController {


    private final AgentProfitService agentProfitService;

    @PostMapping("index")
    public EdenPageResult<?> pageList(@RequestBody AgentProfitQuery profitQuery){
        PageComDto pageDto = agentProfitService.pageList(profitQuery);
        return EdenPageResult.ok(pageDto.getList(), pageDto.getCount());
    }

    @PostMapping("edit")
    public EdenResult<?> editPlat(@RequestBody AgentProfitDto platDto){
        agentProfitService.savePlatParam(platDto);
        return EdenResult.ok("");
    }
}
